import * as THREE from "three";

// 场景
const scene = new THREE.Scene();

const directionalLight = new THREE.DirectionalLight(0xffffff, 1.9);
directionalLight.position.set(400, 200, 300);
scene.add(directionalLight);

// const directionalLight2 = new THREE.DirectionalLight(0xffffff, 1.9);
// directionalLight2.position.set(-400, -200, -300);
// scene.add(directionalLight2);

// const helper = new THREE.DirectionalLightHelper(directionalLight, 50);
// scene.add(helper);

// const helper2 = new THREE.DirectionalLightHelper(directionalLight2, 50);
// scene.add(helper2);

const axesHelper = new THREE.AxesHelper(2500);
scene.add(axesHelper);

const texture = new THREE.TextureLoader().load("/全景2048.jpg");
var geometry = new THREE.SphereGeometry(500, 50, 50);
var material = new THREE.MeshBasicMaterial({
  map: texture,
  side: THREE.BackSide, //默认前面可见，设置为背面可见即可
});
var mesh = new THREE.Mesh(geometry, material);
mesh.position.y += 20;
// mesh.rotateY(Math.PI);
scene.add(mesh);

//设置纹理贴图编码方式和WebGL渲染器或composer后期伽马修正一致
material.map.encoding = THREE.sRGBEncoding;

//环境光
const ambient = new THREE.AmbientLight(0xffffff, 0.9);
scene.add(ambient);

// 设置雾化效果，雾的颜色和背景颜色相近，这样远处网格线和背景颜色融为一体
scene.fog = new THREE.Fog(0xffffff, -100, 2000);

export { scene };
